<!-- 常见问题 -->
<template>
	<view style="position: relative;">
		<view class="row-between float-top-btn-view">
			<button class="row-div top-btn" @click="gotoContactSell">
				<image src="/static/assets/dianhua.png" mode=""></image>
				<text>联系电话</text>
			</button>
			<view class="boderView"></view>
			<button class="row-div top-btn" @click="openService">
				<image src="/static/assets/kefu .png" mode=""></image>
				<text>在线客服</text>
			</button>
		</view>
		<view style="height: 95upx;"></view>

		<view style="padding: 0 30upx;">
			<view :class="{'collapse-view':true,'collapse-view-active':collapseActive == item.hccId}" style="margin-top: 20upx;"
			 v-for="item in collapseDatas" :key="item.hccId">
				<!-- 标题 -->
				<view class="row-between collapse-title" @click="collapseActive == item.hccId ? collapseActive = 0 : collapseActive = item.hccId">
					<view class="title-text">{{item.name}}</view>
					<uni-icons class="icons-css" v-if="collapseActive == item.hccId" type="arrowup"></uni-icons>
					<uni-icons class="icons-css" v-else type="arrowdown"></uni-icons>
				</view>
				<!-- 信息 列表 -->
				<view class="list-view" v-if="collapseActive == item.hccId" v-for="(citem,cindex) in item.v2HelpCenterForms" :key="citem.hccId">
					<navigator :url="'/pages/utilPage/richText?text='+ citem.helpContent + '&title='+item.label" hover-class="none" class="row-between list-item"
					 :style="{'borderTop':cindex == 0 ? 'none':''}">
						<view>{{citem.helpLabel}}</view>
						<uni-icons class="icons-css" type="arrowright"></uni-icons>
					</navigator>
				</view>
			</view>
		</view>
		
		<g-empty v-if="!collapseDatas.length"></g-empty>

	</view>
</template>

<script>
	export default {
		data() {
			return {
				//详情菜单
				showDetailMenu: false,
				collapseActive: 0,
				collapseDatas: [],
			}
		},
		onLoad() {
			this.gerRequest()
		},
		methods: {
			openService() {
				this.$store.dispatch("openService")
			},
			//咨询
			gotoContactSell() {
				this.$api.globalUtil.gotoContactSell();
			},
			async gerRequest() {
				this.$api.showLoading()
				await this.$api.globalUtil.requestAjax({
					url: '/helpCenterApi/getHelpCenterListApi',
					method: "POST",
					data: {},
					success: (res) => {
						if (!res.data.success) return this.$api.msg(res.data.msg || '获取失败');
						this.collapseDatas = res.data.response || [];
					},
					complate: () => this.$api.hideLoading()
				});
			}
		}
	}
</script>

<style scoped lang="scss">
	/* header部分 */
	.header-Container {
		width: 100%;
		height: 176rpx;
		overflow: hidden;
		box-shadow: 0px 1rpx 1rpx 0px rgba(0, 0, 0, 0.08);
		background: rgba(255, 255, 255, 1);

		.leftBtns {
			display: flex;
			align-items: center;
			justify-content: flex-start;
			position: absolute;
			bottom: 0;
			width: 100%;
			height: 86rpx;

			.back {
				margin-left: 17rpx;
				width: 44rpx;
				height: 44rpx;
			}
		}

		/deep/.title {
			position: absolute;
			bottom: 0;
			width: 100%;
			height: 86rpx;
			line-height: 86rpx;
			text-align: center;
			font-size: 36rpx;
			font-family: PingFang SC;
			font-weight: bold;
			color: rgba(51, 51, 51, 1);
		}
	}

	.icons-css {
		font-size: 30upx !important;
		color: #666666 !important;
	}

	.float-top-btn-view {
		position: fixed;
		width: 100%;
		height: 95upx;
		padding: 15upx;
		background: #FFFFFF;
		border-radius: 0upx 0upx 10upx 10upx;
		z-index: 9;

		.top-btn {
			width: 100%;
			height: 100%;
			background: #FFFFFF;
			font-size: 30upx;
			font-family: PingFang SC;
			font-weight: bold;
			color: #333333;
			&::after {
				border: none !important;
			}
		}

		image {
			width: 47upx;
			height: 39upx;
		}

		text {
			margin-left: 25upx;
		}
	}

	.boderView {
		width: 2upx;
		height: 100%;
		background: #EEEEEE;
		border-radius: 1px;
	}

	.collapse-view {
		background: #FFFFFF;
		border-radius: 10upx;

		/* 标题 */
		.collapse-title {
			padding: 35upx 30upx;
			border-radius: 10px;

			.title-text {
				font-size: 28upx;
				font-family: PingFang SC;
				font-weight: bold;
				color: #333333;
			}
		}

		.list-view {
			padding: 0upx 51upx 0upx 60upx;

			.list-item {
				padding: 40upx 0upx;
				font-size: 26upx;
				font-weight: 500;
				color: #666666;
				border-top: 1upx solid #EEEEEE;
			}
		}
	}

	.collapse-view-active {
		.collapse-title {
			border-bottom: 1upx solid #EEEEEE;
			opacity: 0.8;
			box-shadow: 0upx 3px 6px 0px rgba(173, 173, 173, 0.08);
			border-radius: 10px 10px 0px 0px;

			.title-text {
				font-size: 28upx;
				font-family: PingFang SC;
				font-weight: bold;
				color: #FE5E49;
			}
		}
	}
</style>
